﻿@{
    ViewBag.Title = "DatCauHoi";
    Layout = "~/Views/Shared/_Khung.cshtml";

    ViewBag.SiteMap = new string[] 
    {
        "Trang chủ", "/TrangChu",
        "Hỏi đáp", "/HoiDap",
        "Đặt câu hỏi", "/HoiDap/DatCauHoi"
    };

    TempData["TimKiem"] = "HoiDap";
}

<link href="~/Content/css/HoiDap/DatCauHoi.css" rel="stylesheet" type="text/css" />

<link href="~/Content/froala/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/froala/css/froala_editor.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/froala/css/themes/gray.min.css" rel="stylesheet" type="text/css" />

<form id="khung-dang-cau-hoi" class="khung-dang-cau-hoi" method="post" action="~/HoiDap/DangCauHoi" enctype="application/x-www-form-urlencoded">
    <select class="chu-de-cau-hoi" name="ChuDe">
        <option value="0" hidden="hidden">Chọn chủ đề</option>
        @{
            List<LCTMoodle.Models.ViewModels.TuKhoaViewModel> tuKhoas = LCTMoodle.Service.TuKhoaService.layTuKhoa();
            if (tuKhoas == null)
            {
                TempData["ThongBao"] = new string[]
                    {
                        "Lấy chủ để thất bại"
                    };
            }
            else 
            {
                for(int i = 0; i < tuKhoas.Count; i++)
                {
                    @:<option value="@tuKhoas[i].ma">@tuKhoas[i].tuKhoa</option>
                }
            }
        }
    </select>
    <input name="TieuDe" class="title-editor" placeholder="Tiêu đề..." />
    <textarea id="viet-bai" name="NoiDung" class="editor" placeholder="Viết bài..."></textarea>
    <section class="post-button-container">
        <i class="pe-7s-check"></i>
        <input type="submit" value="Đăng" class="post-button" />
    </section>            
</form>

<script src="~/Content/froala/js/froala_editor.min.js"></script>
<script src="~/Content/froala/js/plugins/colors.min.js"></script>
<script src="~/Content/froala/js/plugins/font_size.min.js"></script>
<script src="~/Content/froala/js/plugins/lists.min.js"></script>
<script src="~/Content/script/HoiDap/DatCauHoi.js"></script>

<script>
    $('#viet-bai').editable({
        inlineMode: false,
        buttons: ['bold', 'italic', 'underline', 'fontSize', 'color', 'align', 'formatBlock', 'insertOrderedList', 'insertUnorderedList', 'createLink', 'insertImage'],
        zIndex: 3,
        theme: 'gray',
        blockTags: ['p', 'pre', 'blockquote']
    });
</script>